package com.example.demo.services.impl;

import com.example.demo.dao.CCRepository;
import com.example.demo.entity.CC;
import com.example.demo.services.CCService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author: Ding XiJie
 */
@Service
public class CCServiceImpl implements CCService {
    @Autowired
    private CCRepository ccRepository;

    /**
     * @Author: Ding XiJie
     * @Description: 添加存储
     */
    @Override
    public CC save(CC cc) {
        cc = ccRepository.save(cc);
        return cc;
    }

    /**
     * @Author: Ding XiJie
     * @Description: 修改存储
     */
    @Override
    public CC update(CC cc) {
        return ccRepository.save(cc);
    }

    /**
     * @Author: Ding XiJie
     * @Description: 删除存储
     */
    @Override
    public void delete(int id) {
        ccRepository.deleteById(id);
    }
}
